package com.renwei.yunlong.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.renwei.yunlong.R;
import com.renwei.yunlong.bean.WorkAnnexBean;
import com.zyf.fwms.commonlibrary.base.baseadapter.BaseRecyclerViewAdapter;

/**
 * 工单信息  附件 --adapter
 * <p>
 * Created by Administrator on 2017/9/6.
 */

public class WorkAnnexAdapter extends BaseRecyclerViewAdapter<WorkAnnexBean.Rows> {

    public WorkAnnexAdapter(Context context) {
        super(context);
    }

    @Override
    public WorkAnnexViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_work_annex, parent,false);
        return new WorkAnnexAdapter.WorkAnnexViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder rholder, final int position) {
        WorkAnnexViewHolder holder = (WorkAnnexViewHolder) rholder;
        WorkAnnexBean.Rows rows = mList.get(position);

        holder.tvName.setText(rows.getAttachName());
        holder.tvSize.setText(rows.getAttachSize());
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mOnItemClickLitener.onItemClick(v, position);
            }
        });
    }


    static class WorkAnnexViewHolder extends RecyclerView.ViewHolder {
        private View itemView;
        private TextView tvName;//图片名称
        private TextView tvSize;//图片大小

        public WorkAnnexViewHolder(View view) {
            super(view);
            itemView = view;
            tvName = itemView.findViewById(R.id.tv_name);
            tvSize = itemView.findViewById(R.id.tv_size);
        }
    }

}
